import java.util.HashMap;
import java.util.Map;

public class Solution2325 {
    public String decodeMessage(String key, String message) {
        Map<Character,Character> map=new HashMap<>();
        int now=0;
        for (char c : key.toCharArray()) {
            if (!map.containsKey(c) && c!=' '){
                map.put(c,(char)(now +'a'));
                now++;
            }
        }
        StringBuilder stringBuilder=new StringBuilder();
        for (char c : message.toCharArray()) {
            stringBuilder.append(map.getOrDefault(c,c));
        }
        return stringBuilder.toString();
    }

    public static void main(String[] args) {
        System.out.println(new Solution2325().decodeMessage("the quick brown fox jumps over the lazy dog","vkbs bs t suepuv"));
    }
}
